require 'InterpreterFactory.rb'

class BookingClient
  factory = InterpreterFactory.new()
  begin
    int = factory.getBookingInterpreter
    puts('interpreter.date("2012-01-31").flightNr("KLM137").flightNr("GWI101").person("Stijn","Stijnen","M").person("Jan","Jansens","M").firstClass().hold()')
    puts('Holding 2 flights for 2 person. BookingIds:')
    puts(int.date("2012-01-31").flightNr("KLM137").flightNr("GWI101").person("Stijn","Stijnen","M").person("Jan","Jansens","M").firstClass().hold())
  rescue Exception 
    puts($!)
  end
  
  begin
    int = factory.getBookingInterpreter
    puts('')
    puts('interpreter.bookingId("a52fc08cd6373ca52e5d1ae892e994b4").bookingId("774700dc9fadc608407959ac390d7e55").bookingId("71a654f23e32b411fa7ce54091872214").bookingId("6e3eab9798dbbe8fd796dc9edf3f9f11").cancel()')
    puts('Cancelling 4 bookingIds:')
    int.bookingId("a52fc08cd6373ca52e5d1ae892e994b4").bookingId("774700dc9fadc608407959ac390d7e55").bookingId("71a654f23e32b411fa7ce54091872214").bookingId("6e3eab9798dbbe8fd796dc9edf3f9f11").cancel()
    puts("Cancel succesfull.")
  rescue Exception 
    puts($!)
  end
  
  begin
    int = factory.getBookingInterpreter
    puts('')
    puts('interpreter.date("2012-01-31").flightNr("KLM137").flightNr("GWI101").person("Stijn","Stijnen","M").person("Jan","Jansens","M").firstClass().hold()')
    puts('Holding 2 flights for 2 person. BookingIds:')
    puts(int.date("2012-01-31").flightNr("KLM137").flightNr("GWI101").person("Stijn","Stijnen","M").person("Jan","Jansens","M").firstClass().hold())
  rescue Exception 
    puts($!)
  end
  
  
  begin
    int = factory.getBookingInterpreter
    puts('')
    puts('interpreter.details("a52fc08cd6373ca52e5d1ae892e994b4").details("774700dc9fadc608407959ac390d7e55").details("71a654f23e32b411fa7ce54091872214").details("6e3eab9798dbbe8fd796dc9edf3f9f11").s.query()')
    puts('Holding details:')
    puts(int.details('a52fc08cd6373ca52e5d1ae892e994b4').details('774700dc9fadc608407959ac390d7e55').details('71a654f23e32b411fa7ce54091872214').details('6e3eab9798dbbe8fd796dc9edf3f9f11').query())
  rescue Exception 
    puts($!)
  end
  
  begin
    int = factory.getBookingInterpreter
    puts('')
    puts('interpreter.bookingId("a52fc08cd6373ca52e5d1ae892e994b4").bookingId("774700dc9fadc608407959ac390d7e55").bookingId("71a654f23e32b411fa7ce54091872214").bookingId("6e3eab9798dbbe8fd796dc9edf3f9f11").book()')
    puts('Booking 4 holdings.  Bookinginfo:')
    puts(int.bookingId("a52fc08cd6373ca52e5d1ae892e994b4").bookingId("774700dc9fadc608407959ac390d7e55").bookingId("71a654f23e32b411fa7ce54091872214").bookingId("6e3eab9798dbbe8fd796dc9edf3f9f11").book())
  rescue Exception 
    puts($!)
  end
  
  begin
    int = factory.getBookingInterpreter
    puts('')
    puts('interpreter.details("a52fc08cd6373ca52e5d1ae892e994b4").details("774700dc9fadc608407959ac390d7e55").details("71a654f23e32b411fa7ce54091872214").details("6e3eab9798dbbe8fd796dc9edf3f9f11").s.query()')
    puts('Holding details:')
    puts(int.details('a52fc08cd6373ca52e5d1ae892e994b4').details('774700dc9fadc608407959ac390d7e55').details('71a654f23e32b411fa7ce54091872214').details('6e3eab9798dbbe8fd796dc9edf3f9f11').query())
  rescue Exception 
    puts($!)
  end
  
  begin
    int = factory.getBookingInterpreter
    puts('')
    puts('interpreter.bookingId("a52fc08cd6373ca52e5d1ae892e994b4").bookingId("774700dc9fadc608407959ac390d7e55").bookingId("71a654f23e32b411fa7ce54091872214").bookingId("6e3eab9798dbbe8fd796dc9edf3f9f11").cancel()')
    puts('Cancelling 4 bookingIds:')
    int.bookingId("a52fc08cd6373ca52e5d1ae892e994b4").bookingId("774700dc9fadc608407959ac390d7e55").bookingId("71a654f23e32b411fa7ce54091872214").bookingId("6e3eab9798dbbe8fd796dc9edf3f9f11").cancel()
    puts("Cancel succesfull.")
  rescue Exception 
    puts($!)
  end
  
  begin
    int = factory.getBookingInterpreter
    puts('')
    puts('interpreter.details("a52fc08cd6373ca52e5d1ae892e994b4").details("774700dc9fadc608407959ac390d7e55").details("71a654f23e32b411fa7ce54091872214").details("6e3eab9798dbbe8fd796dc9edf3f9f11").s.query()')
    puts('Holding details:')
    puts(int.details('a52fc08cd6373ca52e5d1ae892e994b4').details('774700dc9fadc608407959ac390d7e55').details('71a654f23e32b411fa7ce54091872214').details('6e3eab9798dbbe8fd796dc9edf3f9f11').query())
  rescue Exception 
    puts($!)
  end
  
  begin
    int = factory.getBookingInterpreter
    puts('')
    puts('interpreter.date("2012-01-31").flightNr("KLM137").flightNr("GWI101").person("Stijn","Stijnen","M").person("Jan","Jansens","M").firstClass().book()')
    puts('Booking 2 flights for 2 person. Booking info:')
    puts(int.date("2012-01-31").flightNr("KLM137").flightNr("GWI101").person("Stijn","Stijnen","M").person("Jan","Jansens","M").firstClass().book())
  rescue Exception 
    puts($!)
  end
  
  puts("-----------------")  
end